package com.iot08.api.service;

import com.iot08.api.vo.request.GoldCoinDescAddReqVo;
import com.iot08.common.entity.app.GoldCoinDesc;
import com.iot08.common.service.base.BaseService;
import com.iot08.common.utils.response.ResponseMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author cwj
 * @description
 * @date 2025/3/26 15:12
 **/
@Slf4j
@Service
public class GoldCoinDescService extends BaseService<GoldCoinDesc> {



    /**
     * @description 新增金币信息
     * @author cwj
     * @param [vo]
     * @return com.iot08.common.utils.response.ResponseMap
     * @date @time 2025/3/26 15:42
     **/
    public ResponseMap addGoldCoinDesc(GoldCoinDescAddReqVo vo) {
        GoldCoinDesc goldCoinDesc = new GoldCoinDesc();
        goldCoinDesc.setGoldCoinDescContent(vo.getGoldCoinDescContent());
        goldCoinDesc.setCreateTime(new Date());
        goldCoinDesc.setUpdateTime(new Date());
        this.save(goldCoinDesc);
        return ResponseMap.success();
    }

    /**
     * @description
     * @author cwj
     * @param []
     * @return com.iot08.common.entity.app.GoldCoinDesc
     * @date @time 2025/3/26 15:44
     **/
    public GoldCoinDesc queryGoldCoinDesc(){
      return this.findOne(new Query().limit(1));
    }

}
